home *** CD-ROM | disk | FTP | other *** search
/ Multimedia Toolkit 2 / Multimedia Toolkit 2.iso / imagine / imaginetutorial / brushmap.tutorial.pp / brushmap.tutorial
Encoding:
Text File  |  1991-09-07  |  20.3 KB  |  424 lines

  1.  
  2.  
  3. Brush Maps. Second in a series about adding personal touches to
  4. your Imagine objects. I'm sure this is the one that is more useful,
  5. since brush maps are inherently confusing.
  6.  
  7.  
  8. -Steve
  9.  
  10.  
  11. ------------------------------------------------------------------------------
  12.  
  13.  
  14. Textures are not the only way to add detail to an object. A more direct,
  15. less elegant, but more personallizable method is to use brush maps. Brush
  16. maps are ways of taking standard Amiga pictures (sometimes called IFFs,
  17. though pictures are a subset of the Interchange File Format) that can be
  18. placed "by hand" on your object. In its easiest incarnation, you could brush
  19. map a picture of your face onto a flat plane, put a frame (using wood
  20. texture! ) around it, and you have a virtual art piece. In its most complex
  21. incarnation, you could take a set of 40 256-level intensity maps saved as
  22. IFF24s and tile them endlessly on a plane during a 40 frame anim, and have
  23. the map pixel intensity create reflections and highlights from the flat
  24. plane just like it was really an animated, wind-wave covered ocean.
  25.  
  26. Brush maps can give objects the same four characteristics that textures can-
  27. surface color, reflection, transparency, and surface orientation. Going back
  28. to the "my face in a frame" example, a color map is straightforward. A
  29. reflection map will reflect the color and intensity of light corresponding
  30. to the map- in other words, a black map would make the picture in the frame
  31. reflect no light, a white map would make the picture a mirror, and a yellow
  32. map would make only yellow light reflect. [The yellow example is not
  33. strictly true.. the yellow-mirror would reflect green and red light, which
  34. combine to make yellow]. Transparency (really filter) is similar. Black is
  35. opaque, pure white is the clearest crystal, and yellow would let yellow
  36. light though.  An example given by Rick Rodriguez in his manual is that a
  37. filter map of your face applied to a plane would be like a stained-glass
  38. window. You could have fun with that. Note that transparent objects have an
  39. index of refraction, which is set in the attributes requester. See my
  40. article, "The Art of Glass" for a much more detailed discussion on
  41. transparency.
  42.  
  43. The last brush type is altitude, which is a bit more tricky. Here, the
  44. IMAGINE MANUAL IS COMPLETELY WRONG! [Sorry, Rick!] The manual describes a
  45. "displacement map", which is somewhat similar. An altitude map just tells
  46. Imagine that light hitting the object's surface should be reflected,
  47. refracted, and specularated (!) as if it hit a surface that had a certain
  48. shape to it- the shape describedthe brushmap's intensity. If you mapped a
  49. picture with lots of small fuzzy grey dots onto a sphere, you would get
  50. reflections and light highlights as if the sphere had tiny pits in it like
  51. an orange. NOTE! The altitude map does NOT change the real surface height of
  52. your object at all. THIS is the difference between a displacement map and an
  53. altitude map.
  54.  
  55. One option you should use if you're using transparency map is the "Full
  56. Scale Value" in the brush requester. This allows you to tell Imagine how
  57. transparent a pure white image should be. If you want pure white to be
  58. COMPLETELY transparent (invisible) set this number to 255 (full scale).  If
  59. you set the number lower, you get full white to become opaque to whatever
  60. degree you wish. If you're making a stained glass window, you might want to
  61. set the number to 200 so that people can SEE that there is "glass" even
  62. where there is a clear pane.  Impulse's old default was 245, I think.
  63.  
  64. Any standard Amiga IFF can be used as a map. This includes all pictures
  65. savedDeluxe Paint, the most common picture editing program on the Amiga. A
  66. format of high color resolutions known as IFF24 saves three bytes of color
  67. information per pixel and produces beautiful color reproduction. These
  68. IFF24s can be producedthe ToasterPaint, Digi-view RGB saves (only 21 bits,
  69. but it is saved as 24 for compatibility), The Art Department, and many other
  70. graphics programs. The Art Department is the penultimate tool for
  71. manipulating 24-bit (and other) images- it can scale, compost, and
  72. manipulate 24-bit pictures painlessly, as long as you have RAM. [It is NOT a
  73. drawing program, though] Whatever type of brush you use, remember that
  74. Imagine can't do magic to your pictures- a 16 color picture of yourself is
  75. going to look positively cheesy compared to a 24-bit picture. For some
  76. applications, though, you don't need much more.  Applying a 4-color logo to
  77. an object won't benefit by using a 16 million color brush - just use 4.
  78. Also, higher resolution is obviously higher quality, though it's pointless
  79. to use a 1000 by 1000 picture of a logo- even in a close-up shot, it would
  80. be indistinguishable from a 640 by 400 picture. Too low a resolution, though
  81. will be painfully obvious when you render. Depending on how close of a view
  82. you use in Imagine, you usually don't need more than 320 by 200. Again, this
  83. is very dependent on how close your camera view is. I've used 100 by 100
  84. brushes to great effect.
  85.  
  86. A fun trick- Imagine can easily _OUTPUT_ IFF24s... you can use a previous
  87. rendering as a brush map. 
  88.  
  89. If you are truly interested in making high quality brush maps, you should
  90. definately use IFF24s as brushes. If you have DCTV, you have a terrific
  91. paintbox for editing pictures. Toasterpaint also works, but is not pleasant.
  92. If you don't have either (like me!), you can use a trick that works
  93. extremely well.  I take a picture to be edited (often grabbed with
  94. Digiview!) and in Art Department size it to about 900 by 600 (this is very
  95. RAM limited... grey images can get 3 times as large). Then I display the
  96. picture in overscan dithered EHB, and save this image. Then I power up
  97. Deluxe Paint, and edit the picture. EHB gives you loads of colors to deal
  98. with, so you don't lose too much color resolution. [You do lose some!]
  99. DPaint can take brushmaps of any size [RAM limited!], and editing them is
  100. quite easy. With the very large scale, individual pixels don't matter much,
  101. so I use large brushes and the airbrush especially. When you're done
  102. editing, I save the picture, and use Art Department to resize the image back
  103. to its original size. For 24 bit pictures of a size of about 128 by 128, the
  104. quality is terrific! You can see some of the brushes I made posted to ab20
  105. and hubcap (the sidewalk and latticework, and my latest brick wall).
  106.  
  107. Sources of hi-quality pictures are everywhere. Digi-view is your friend- it
  108. can make 768 by 480 resolution 24-bit pix. Toaster camera frame grabs will
  109. give you 24-bit pix at a resolution of 768 by 240.  A fun source of varying
  110. quality images are GIFs. GIFs are a graphic picture format, most popular on
  111. MS-DOG computers. There are THOUSANDS of pictures, most with 256 colors out
  112. of 16 million.  You can find about 1000 with a nice index on the anonymous
  113. FTP site wuarchive.wustl.edu.  I often take these pix and shrink them by 1/2
  114. and save them as 24-bit IFFs- there's no color loss and the file size is
  115. much smaller.
  116.  
  117. Once you have your map and know what you want to do with it, you have to
  118. place it on your object. The placement determines the size and orientation
  119. of the map, as well as how much of the object is influenced, and in the case
  120. of altitude maps, how much surface light is distorted.
  121.  
  122. There are three basic types of wrap- a "flat" wrap (Flat X Flat Z), a
  123. "sphere" wrap (Wrap X Wrap Z), and a "cylinder" wrap (Flat X, Wrap Z and
  124. Wrap X, Flat Z). Flat will ignore any surface bumps and features and just
  125. apply itself directly, much like a slide projector would project onto a
  126. bumpy screen. A sphere wrap tries to encase the object in the brush, then
  127. shrinkwrap the map onto all of the surface features of the object. The
  128. cylinder wrap tries to follow contours in one direction, but ignore them in
  129. another. Think of taking a piece of gift wrap, and bending it around so its
  130. a hollow cylinder.  Then place the object in the center of this vertical
  131. gift wrap cylinder and push IN (but not up or down!) to follow the object
  132. contours.
  133.  
  134. Placing the maps is sometimes tricky. Mike Halvorson wrote a description
  135. that was posted about 6 weeks ago, you can find it in the Imagine list
  136. archives. Also, the green Impulse Winter 1991 bulletin had two very useful
  137. diagrams. What I'm about to describe is not as simple and foolproof as just
  138. looking at the 4 simple pictures they printed, due to the mere fact that
  139. ASCII graphics suck. But I'll try!
  140.  
  141. FLAT "WRAPS"
  142.  
  143.   Flat wraps are the most common and certainly the most controllable of the
  144. brush map types. Think of having a decal or poster that you want to stick
  145. onto a wall. Flat wrapping will do just this. A good example is trying to
  146. put a logo onto the side of a truck- an excellent example of where brush
  147. maps shine.
  148.  
  149. First, you should obviously have your logo picture and truck designed and
  150. ready. Now, to place the brush onto an object, you should probably use the
  151. "Edit Axes" mode. This lets you move the axes with the same mouse and
  152. keyboard commands that you normally use for objects... m for move, s for
  153. scale, r for rotate, x,y,and z to toggle a direction.
  154.  
  155. A danger with editing brush axes is that you want to be in LOCAL mode,
  156. especially when you are scaling the brush axis in just one direction (like
  157. you were trying to increase its height, keeping the same width and depth.)
  158. If you don't scale in LOCAL mode, sometimes your changes don't stick. You
  159. can check by selecting "Edit Axes" again to make sure nothing changes after
  160. you're done.
  161.  
  162.  
  163. The axis you are editing has a bit yellow bounding box that is very
  164. deceiving. THE AREA WHERE THE BRUSH IS ACTUALLY MAPPED IS JUST THE UPPER
  165. RIGHT QUADRANT OF THIS BOX. The brush is placed with its lower left corner
  166. right at the center of the axes, and its upper right corner at a point
  167. definedthe X and Z axes of the brush map axis.  Got that?
  168.  
  169.             Z 
  170.  +----------^------------+     Front View
  171.  |          |xxxxxxxxxxxx|
  172.  |          |x Picture xx|
  173.  |          |xx Area xxxx|
  174.  |          |xxxxxxxxxxxx|
  175.  |          +------------> X
  176.  |                       |
  177.  |                       |
  178.  |                       |
  179.  |                       | <-brush map bounding box
  180.  +-----------------------+ 
  181.  
  182.  
  183. You want to position the axes so that the upper-right quadrant lies exactly
  184. where you want your brush to lie. If you want your brush to cover the entire
  185. side of the truck, you'd probably want to make the brush a few extra pixels
  186. high and wide so that you don't accidentally get a border around the edge of
  187. your logo.
  188.  
  189. The Y axis of the brush map is pretty important as well. It tells Imagine
  190. how DEEP to apply your brush. Basically, any part of the object that falls
  191. between the axis origin and the tip of the Y axis WILL be colored (or
  192. reflected, or whatever). For the truck, you'd want to move and scale the
  193. brush axis in the Y direction so that the Y axis line INTERSECTS one side of
  194. the truck but NOT the other. The intersected side of the truck would be
  195. within the influence of the brush map, whereas the other side of the truck
  196. would be left alone. If you scaled the Y axis to include both truck sides,
  197. the other side of the truck would get the brush map applied to it as well.
  198. [In fact, you'd see a mirror image of the brush on the other side, since
  199. you'd be looking at it in the other direction.]
  200.  
  201. Here's a terrible ASCII drawing showing how you'd position a brush so that
  202. it puts a very small logo on the side of a big rectangular solid, like a
  203. truck body.
  204.  
  205.                  FRONT VIEW
  206.  
  207.  
  208.         +-----------------------------------------+
  209.         |                                         | <-Truck body
  210.         |                                         |
  211.         |                                         |
  212.         |                  ^ X                    |
  213.         |                  |                      |
  214.         |        Brush     |                      |
  215.         |        axis->    +-----> Z              |
  216.         |                                         |
  217.         |                                         |
  218.         |                                         |
  219.         |                                         |
  220.         +-----------------------------------------+
  221.  
  222.  
  223. ===============================================================
  224.  
  225.  
  226.                   TOP VIEW
  227.  
  228.         +-----------------------------------------+ <-Truck Body
  229.         |                                         |
  230.         |                                         |
  231.         |                                         |
  232.         |                                         |
  233.         |                                         |
  234.         |                  ^ Y                    |
  235.         |                  |                      |
  236.         +------------------+----------------------+
  237.                            |
  238.               Brush->      +-----> Z
  239.                Axis
  240.  
  241.  
  242.  
  243. See how the Y axis only intersects one side?
  244.  
  245. That's about it for flat wrapping. It is pretty easy to control where
  246. the brush gets applied to any object.
  247.  
  248.  
  249. WRAP X WRAP Z  WRAPS
  250.  
  251. -----
  252.  
  253. These are the most complex wraps. The Y axis here isn't really used,
  254. since the wrap is applied to the whole object surface, not just part.
  255.  
  256. You want to position the axes so that the Z axis covers the entire height of
  257. the object... its height should be slightly TALLER than the object. The X
  258. axis should be thought as a "radius of influence"... it should be a little
  259. bit bigger than HALF the width of the object.  The axis should be placed
  260. (LOOKING DOWN!!) at the center of the object, and looking from the side, at
  261. the bottom of the object. The Z axis should pass through and be slightly
  262. bigger than the object's height.  The X axis should be slightly bigger than
  263. the object's maximum radius away from the center. The Y axis size doesn't
  264. matter. Keep it small, suggests Impulse.
  265.  
  266.  
  267. OK, Here's the diagram. The object is a sphere. I swear!
  268.  
  269. ===========================================================
  270. FRONT VIEW
  271.                      ^ Z <- brush axis
  272.                      |
  273.                    __|__
  274.                   /  |  \
  275.                  -   |   -
  276.                 /    |    \
  277.                /     |     \
  278.               |      |      |
  279.               |      |      | 
  280.               |      |      | <-Sphere-like object
  281.               |      |      |
  282.               \      |     /
  283.                \     |    /
  284.                 -    |   - 
  285.                  \   |  /
  286.                   ---+--
  287.                      |
  288.                      +--------> X  
  289.  
  290.  
  291. ===========================================================
  292. TOP VIEW
  293.                    _____
  294.                   /     \
  295.                  -       -   <-Sphere-like object
  296.                 /         \
  297.                /           \
  298.               |      ^ Y    |
  299.               |      |      | 
  300.               |      +------+-> X
  301.               |             |   Brush Axes 
  302.               |             |
  303.               \            /
  304.                \          /
  305.                 -        - 
  306.                  \      /
  307.                   ------
  308.  
  309.  
  310.  
  311. That's it! If you wrap a picture of a grid of lines, it will come
  312. out looking like latitude and longitude lines on a globe.
  313.  
  314.  
  315.  
  316. CYLINDER WRAPS (WRAP X, FLAT Z, FLAT X, WRAP Z)
  317.  
  318. The brush placement is identical to the placement used for the spherical
  319. wrap. The effect is quite different, however. If you tried cylinder wrapping
  320. the grid picture onto a sphere, you'd get OK latitude lines (going
  321. North-South) but the longitude lines would get further apart the closer you
  322. were to the poles, due to the flat projection of the horizontal lines. The
  323. lines themselves would also be wider at the poles.
  324.  
  325.  
  326. One last note for brush axis placement- for adding ALTITUDE maps, the Y axis
  327. depth is used to measure how much indentation a full scale range of
  328. intensity (0-255) should simulate. For cylinder and sphere wraps, just scale
  329. the Y axis. For orange pits, the axis might be 1% of the sphere's size. For
  330. an eroded planet, you might use 10%. More than this would make really stupid
  331. looking reflections. Altitude maps are subtle.
  332.  
  333. The Y depth is also used for flat altitude wraps, which might limit you if
  334. you want to indent both sides of a truck. You'd have to use two brushes in
  335. this case. I would have preferred a number gadget in the brush requester.
  336.  
  337. ----------
  338.  
  339. Once you know how to place individual brushes, you can start with the fancy
  340. tricks. Brushes overlay each other just like textures. You can put up to 4
  341. brushes on an object, and they are applied in order. Many maps don't
  342. interfere, though- you could have a color map and a reflection map on the
  343. same object in the same place. Both will work just fine.
  344.  
  345. I am not positive, but I'm pretty sure brushes are put on AFTER
  346. textures are applied. Otherwise you'd get wood grain on your face. :-)
  347.  
  348. Repeating brushmaps are a joy. They "tile" an object with an endless
  349. succession of images both side to side and top to bottom. The brush will
  350. repeat all the way out the the end of the object. If you tile a ground, the
  351. brushes will go to infinity. The size of each tile is set by the brush axes,
  352. just like a non-tiled map. The brushes are placed next to each other with no
  353. space between them. You could draw a VERY detailed picture of a bathroom
  354. tile, and map it onto a wall.  when rendered, the wall would be (surprise)
  355. tiled! I've used this to GREAT effect for making very detailed sidewalks,
  356. rose trellises, brick walls, roof shingles, and golf greens. All of these
  357. are flat wraps. To be honest, I haven't tried infinite tiled wrap wraps...
  358. I'm not sure what they'd do!
  359.  
  360. Placing repeating brushmaps is just the same as a regular flat wrap.  The
  361. size of the brush is determinedthe X and Z axis, and the "depth of
  362. influence" is determinedthe Y axis.
  363.  
  364. One additional option that is very useful is the "mirror" option. This makes
  365. every tile be a mirror reflection of its neighbor. The great advantage of
  366. this is that the edge colors ALWAYS match, just like if your finger touches
  367. a mirror, your twin in the mirror will reach out and touch your finger at
  368. the exact same place. This might hide discontinuities in your brushmap if
  369. you want to hide the seams, or it might be a special effect you're looking
  370. for.
  371.  
  372. Repeating brushmaps aren't just for covering an infinite plain with your
  373. face. They can be an extremely powerful way to get very complex textures on
  374. an object. You can imagine drawing one very high resolution, high quality
  375. brick with scratches, pits, chips and tiny detail, then tiling it onto a
  376. wall. Presto! You have a brick wall with a lot of character, unlike the
  377. Brick texture which is too plain to fool anyone up close. This is probably
  378. the most useful aspect of infinite tilings. You can find my infinite
  379. sidewalk, infinite golf green, infinite brick wall (very nice!) and infinite
  380. rose trellis on ab20 and hubcap.
  381.  
  382. When I refer to "ab20" and "hubcap" I mean the anonymous FTP sites
  383. ab20.larc.nasa.gov and hubcap.clemson.edu, both of which have a lot of
  384. Imagine files, objects, brush maps and goodies that I've uploaded.  There is
  385. also an archive of this list on both sites. If you need to know if you have
  386. FTP access and how to use it, ask one of your local computer experts- they
  387. should be able to help you.
  388.  
  389. The last brush map ability is very useful. You can actually have ANIMATED
  390. brush maps which change every frame.  Note that these pictures are not
  391. "AnimBrushes" that DPaint will save. These are individual pictures, which
  392. means you can have a 24 bit "animbrush."  To use this feature, you should
  393. save the sequence of pictures you wish to show in a format like
  394.    
  395.   Mypic.0001
  396.   Mypic.0002
  397.   Mypic.0003
  398.   Mypic.0004
  399.   Mypic.0005
  400.  
  401. and so on up to however many pictures you have. Make sure to have FOUR
  402. numbers in the extension. Mypic.01 will NOT work. To use this sequence of
  403. pictures as an animation, you should use "Mypic" as the brush file name
  404. [without the quotes], then set the "Max sequence #" to the number of
  405. pictures you have. I wrote a LONG article about how you can make animations
  406. of yourself using Digi-View and a VCR. You might have seen the animation
  407. with me "trapped" inside of this giant sphere rolling around on a plane,
  408. with my pitiful attempts to break out recorded in 16 glorious colors. You
  409. too can do this with YOUR setup. It's worth playing with! You can find the
  410. article in the Imagine archives on hubcap.
  411.  
  412. That's all there is to brush maps. They can add a lot of detail to your
  413. objects, and they're not hard to use if you know how to place the axes. Go
  414. out and create!
  415.  
  416.  
  417.  
  418. -Steve "Boy, are my fingers tired" Worley
  419.  
  420. ---------------------------------------------------------------------------
  421. Steve Worley                                        spworley@athena.mit.edu
  422. ---------------------------------------------------------------------------
  423.  
  424.